package message;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class AddServerRequestMessage extends Message
{
	private static final long serialVersionUID = 1L;
	private String ipAddress;
	
	public String getIpAddress()
	{
		return ipAddress;
	}
	@XmlElement(name="ip", required = true)
	public void setIpAddress(String ipAddress)
	{
		if (this.ipAddress == null)
			this.ipAddress = ipAddress;
	}
	
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((ipAddress == null) ? 0 : ipAddress.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AddServerRequestMessage other = (AddServerRequestMessage) obj;
		if (ipAddress == null)
		{
			if (other.ipAddress != null)
				return false;
		}
		else if (!ipAddress.equals(other.ipAddress))
			return false;
		return true;
	}
}
